﻿using System;
using System.Windows;

namespace Results.Icons
{
    public partial class PlayerIcon
    {
        public PlayerIcon()
        {
            InitializeComponent();
        }

        public String Gender
        {
            get { return (String)GetValue(GenderProperty); }
            set { SetValue(GenderProperty, value); }
        }

        public static readonly DependencyProperty GenderProperty = DependencyProperty.Register("Gender", typeof(String), typeof(PlayerIcon), new PropertyMetadata(new PropertyChangedCallback(OnGenderChanged)));

        static void OnGenderChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var playerIcon = d as PlayerIcon;

            if (playerIcon != null)
            {
                VisualStateManager.GoToState(playerIcon, playerIcon.Gender, true);
            }
        }
    }
}
